package com.yinkgh.mybatis;

import java.io.InputStream;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class MybatisUtil {

	public static SqlSession getSqlSession() {
		SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
//		Resources.getResourceAsStream("");
//		InputStream config = MybatisUtil.class.getClassLoader().getResourceAsStream("mybatis-config.xml");
		InputStream config = MybatisUtil.class.getClassLoader().getResourceAsStream("applicationContext.xml");
		SqlSessionFactory sessionFactory = builder.build(config);
		SqlSession sqlSession = sessionFactory.openSession();
		return sqlSession;
	}

	
	public static void main(String[] args) {
		
		
		
	}
	
	
}
